﻿using System.Reflection;

namespace Mbs.Reflection
{
    public delegate object Getter(object target);
    //public delegate object Getter(object target,object[] args);

    public static class FieldGetterExtensions
    {
        public static object Get(this FieldInfo field, object target)
        {
            return DynamicMethodFactoryProxy.Instance.CreateGetter(field)(target);
        }
    }

    public static class PropertyGetterExtensions
    {
        public static object Get(this PropertyInfo property, object target)
        {
            return DynamicMethodFactoryProxy.Instance.CreateGetter(property)(target);
        }
    }
}
